package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.ActivityListVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/7/17 11:10
 * 修改备注：
 * ================================================
 */

public class ActivityListHolder extends BaseViewHolder<ActivityListVO> {

    private SimpleDraweeView ivPicture;
    private TextView tvState;
    private TextView tvPrice;
    private TextView tvTitle;
    private TextView tvAddress;
    private TextView tvTime;


    public ActivityListHolder(ViewGroup parent) {
        super(parent, R.layout.item_activity_list);
        ivPicture = $(R.id.iv_picture);
        tvState = $(R.id.tv_state);
        tvPrice = $(R.id.tv_price);
        tvTitle = $(R.id.tv_title);
        tvAddress = $(R.id.tv_address);
        tvTime = $(R.id.tv_time);
    }

    @Override
    public void setData(ActivityListVO data) {
        super.setData(data);

        String[] arr = data.getImgPath().split(",");

        FrescoUtil.showImageSmall(arr[0], ivPicture);

        if(data.getIsFee()==null||data.getIsFee().equals("0")){
            tvPrice.setText("免费");
        }else{
            if(data.getFee()!=null){
                tvPrice.setText(data.getFee() + "");

            }else{
                tvPrice.setText("0");

            }
        }

        tvState.setText(data.getActivityStateName() +"");
        tvTitle.setText(data.getActivityName() + "");
        tvAddress.setText(data.getAddress() + "");
        tvTime.setText(data.getCreateTime() + "");

    }

}
